package com.seven.good.controller;

import com.seven.good.client.PayClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * <h3>easyauction</h3>
 *
 * @author : 王胜奔
 * @description : 支付保证金页面
 * @date : 2019-10-30 19:34
 **/
@Controller
public class PayBondController {
    @Autowired
    private PayClient payClient;

    @RequestMapping("/createBondOrder")
    @ResponseBody
    public String test2(Integer gid,Integer uid,Integer order_type,Integer bond) throws IOException {
        ServletRequestAttributes attrs = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        //获取到Request对象
        HttpServletResponse response = attrs.getResponse();
        String payPage=payClient.createBondOrder(gid,1,order_type,bond);
        return payPage;
//        response.setContentType("text/html;charset=utf-8");
//        response.getWriter().println(payPage);
    }
}
